package com.woniuxy.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.entity.Bidding;
import com.woniuxy.entity.BiddingRoom;
import com.woniuxy.service.BiddingRoomService;
import com.woniuxy.utils.ResultUtil;

@Controller
@RequestMapping("/BiddingRoom")
public class BiddingRoomController {

	@Autowired
	BiddingRoomService biddingRoomService;
	
	
	
	//正在竞拍的商品 ：（买家）提交了保证金的就可以查询'我正在竞拍的商品有哪些'   
		@RequestMapping("/find")
		@ResponseBody
		public ResultUtil<List<BiddingRoom>> BiddRoomInfoByuid(int u_id){
			System.out.println("请求进来了");
			List<BiddingRoom> biddroomInfo  = new ArrayList<>();
			biddroomInfo = biddingRoomService. BiddRoomInfoByuid(2);
			ResultUtil<List<BiddingRoom>> result = new ResultUtil<>();
			result.setData(biddroomInfo);
			return result;
		} 
		
	//正在竞拍	
	//实现”正在竞拍的	“的删除功能
		@RequestMapping("/deleroomByuidAndpid")
		@ResponseBody
		public int deleroomByuidAndpid(int pid){
			
			System.out.println(pid);
			int result = biddingRoomService.deleroomByuidAndpid(2, pid);
		
			return result;
		
		}
	// 出价记录
	//正对于竞价室商品查询出竞价表中那些人出了价，展示到页面上，  商品多的话应该还要有搜索功能
		@RequestMapping("/salelogAll")
		@ResponseBody
		public ResultUtil<List<Bidding>> salelogAll(){
			
			System.out.println("出价记录方法进来了");
			
			List<Bidding> result = new ArrayList<>();
			 result =biddingRoomService.salelogAll();
			 
			ResultUtil<List<Bidding>> resultes = new ResultUtil<>();
			resultes.setData(result);
			return resultes;
			
			
			
		}
		
	//出价记录中搜索框
		/*@RequestMapping("/LikeFind")
		@ResponseBody
		public ResultUtil<List<Bidding>> LikeFind(){
			
			
			
		}*/
		
		
		
		
		
}
